package com.example.qts.model;

import com.example.qts.base.BaseModel;
import com.example.qts.base.BaseObserver;
import com.example.qts.bean.Bean;
import com.example.qts.not.ApiServce;
import com.example.qts.not.HttpUlist;
import com.example.qts.not.RxUlist;

import io.reactivex.Observable;

public class ListModel extends BaseModel {
    public void addModel(ListCallBack callBack){
        ApiServce apiServer = new HttpUlist().getApiServer(ApiServce.url, ApiServce.class);
        Observable<Bean> getdata = apiServer.getdata();
        getdata.compose(RxUlist.RxobservableTransformer())
                .subscribe(new BaseObserver<Bean>(this) {
                    @Override
                    protected void onSuccess(Bean bean) {
                        callBack.onSuccess(bean);
                    }

                    @Override
                    protected void onFali(String error) {
                        callBack.onFali(error);
                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }
}
